#!/bin/bash
# centos6-yum-setup.sh

# 备份原有配置
cd /etc/yum.repos.d/
mkdir -p bak
mv *.repo bak/ 2>/dev/null

# 创建正确的CentOS 6.9 yum源配置
cat > /etc/yum.repos.d/CentOS-Base.repo << 'EOF'
[base]
name=CentOS-6.9 - Base - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos-vault/6.9/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[updates]
name=CentOS-6.9 - Updates - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos-vault/6.9/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[extras]
name=CentOS-6.9 - Extras - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos-vault/6.9/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[centosplus]
name=CentOS-6.9 - Plus - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos-vault/6.9/centosplus/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
enabled=0

[contrib]
name=CentOS-6.9 - Contrib - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos-vault/6.9/contrib/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
enabled=0
EOF

# 清理缓存
yum clean all
yum makecache

# 安装Firefox
yum install -y firefox

echo "CentOS 6.9 yum源设置完成！"